home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Libraries / tcl7.4b3 / configure.in < prev    next >
Encoding:
Text File  |  1995-03-24  |  7.5 KB  |  241 lines

  1. dnl    This file is an input file used by the GNU "autoconf" program to
  2. dnl    generate the file "configure", which is run during Tcl installation
  3. dnl    to configure the system for the local environment.
  4. AC_INIT(tcl.h)
  5. # @(#) configure.in 1.6 95/03/24 09:38:10
  6.  
  7. AC_PROG_INSTALL
  8. AC_PROG_RANLIB
  9. AC_PREFIX_PROGRAM(tclsh)
  10. AC_C_CROSS
  11. CC=${CC-cc}
  12. AC_SUBST(CC)
  13.  
  14. #--------------------------------------------------------------------
  15. #    Supply substitutes for missing POSIX library procedures, or
  16. #    set flags so Tcl uses alternate procedures.
  17. #--------------------------------------------------------------------
  18.  
  19. AC_REPLACE_FUNCS(getcwd opendir strerror strncasecmp strstr)
  20. AC_REPLACE_FUNCS(strtol tmpnam waitpid)
  21. AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
  22. AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD))
  23. AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3))
  24.  
  25. #--------------------------------------------------------------------
  26. #    On a few very rare systems, all of the libm.a stuff is
  27. #    already in libc.a.  Set compiler flags accordingly.
  28. #    Also, Linux requires the "ieee" library for math to work
  29. #    right.
  30. #--------------------------------------------------------------------
  31.  
  32. AC_FUNC_CHECK(sin, MATH_LIBS="", MATH_LIBS="-lm")
  33. AC_SUBST(MATH_LIBS)
  34. AC_CHECK_LIB(ieee, main, [MATH_LIBS="$MATH_LIBS -lieee"])
  35.  
  36. #--------------------------------------------------------------------
  37. #    Supply substitutes for missing POSIX header files.  Special
  38. #    notes:
  39. #        - Sprite's dirent.h exists but is bogus.
  40. #        - stdlib.h doesn't define strtol, strtoul, or
  41. #          strtod insome versions of SunOS
  42. #        - some versions of string.h don't declare procedures such
  43. #          as strstr
  44. #--------------------------------------------------------------------
  45.  
  46. AC_HAVE_HEADERS(unistd.h)
  47. AC_MSG_CHECKING(dirent.h)
  48. AC_TRY_LINK([#include <sys/types.h>
  49. #include <dirent.h>], [
  50. #ifndef _POSIX_SOURCE
  51. #   ifdef __Lynx__
  52.     /*
  53.      * Generate compilation error to make the test fail:  Lynx headers
  54.      * are only valid if really in the POSIX environment.
  55.      */
  56.  
  57.     missing_procedure();
  58. #   endif
  59. #endif
  60. DIR *d;
  61. struct dirent *entryPtr;
  62. char *p;
  63. d = opendir("foobar");
  64. entryPtr = readdir(d);
  65. p = entryPtr->d_name;
  66. closedir(d);
  67. ], tcl_ok=yes, tcl_ok=no)
  68. AC_HEADER_EGREP([Sprite version.* NOT POSIX], tcl_ok=no)
  69. if test $tcl_ok = no; then
  70.     AC_DEFINE(NO_DIRENT_H)
  71. fi
  72. AC_MSG_RESULT($tcl_ok)
  73. AC_HEADER_CHECK(errno.h, , AC_DEFINE(NO_ERRNO_H))
  74. AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
  75. AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
  76. AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0)
  77. AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0)
  78. AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0)
  79. AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0)
  80. if test $tcl_ok = 0; then
  81.     AC_DEFINE(NO_STDLIB_H)
  82. fi
  83. AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0)
  84. AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0)
  85. AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0)
  86. if test $tcl_ok = 0; then
  87.     AC_DEFINE(NO_STRING_H)
  88. fi
  89. AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
  90. AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
  91.  
  92. #--------------------------------------------------------------------
  93. #    On some systems strstr is broken: it returns a pointer even
  94. #    even if the original string is empty.
  95. #--------------------------------------------------------------------
  96.  
  97. AC_MSG_CHECKING([proper strstr implementation])
  98. AC_TEST_PROGRAM([
  99. extern int strstr();
  100. int main()
  101. {
  102.     exit(strstr("\0test", "test") ? 1 : 0);
  103. }
  104. ], tck_ok=yes, tcl_ok=no)
  105. if test $tcl_ok = yes; then
  106.     AC_MSG_RESULT(yes)
  107. else
  108.     AC_MSG_RESULT([broken, using substitute])
  109.     LIBOBJS="$LIBOBJS strstr.o"
  110. fi
  111.  
  112. #--------------------------------------------------------------------
  113. #    Check for strtoul function.  This is tricky because under some
  114. #    versions of AIX strtoul returns an incorrect terminator
  115. #    pointer for the string "0".
  116. #--------------------------------------------------------------------
  117.  
  118. AC_FUNC_CHECK(strtoul, tcl_ok=1, tcl_ok=0)
  119. AC_TEST_PROGRAM([
  120. extern int strtoul();
  121. int main()
  122. {
  123.     char *string = "0";
  124.     char *term;
  125.     int value;
  126.     value = strtoul(string, &term, 0);
  127.     if ((value != 0) || (term != (string+1))) {
  128.         exit(1);
  129.     }
  130.     exit(0);
  131. }], , tcl_ok=0)
  132. if test $tcl_ok = 0; then
  133.     test -n "$verbose" && echo "    Adding strtoul.o."
  134.     LIBOBJS="$LIBOBJS strtoul.o"
  135. fi
  136.  
  137. #--------------------------------------------------------------------
  138. #    Check for the strtod function.  This is tricky because in some
  139. #    versions of Linux strtod mis-parses strings starting with "+".
  140. #--------------------------------------------------------------------
  141.  
  142. AC_FUNC_CHECK(strtod, tcl_ok=1, tcl_ok=0)
  143. AC_TEST_PROGRAM([
  144. extern double strtod();
  145. int main()
  146. {
  147.     char *string = " +69";
  148.     char *term;
  149.     double value;
  150.     value = strtod(string, &term);
  151.     if ((value != 69) || (term != (string+4))) {
  152.     exit(1);
  153.     }
  154.     exit(0);
  155. }], , tcl_ok=0)
  156. if test $tcl_ok = 0; then
  157.     test -n "$verbose" && echo "    Adding strtod.o."
  158.     LIBOBJS="$LIBOBJS strtod.o"
  159. fi
  160.  
  161. #--------------------------------------------------------------------
  162. #    Check for various typedefs and provide substitutes if
  163. #    they don't exist.
  164. #--------------------------------------------------------------------
  165.  
  166. AC_MODE_T
  167. AC_PID_T
  168. AC_SIZE_T
  169. AC_UID_T
  170.  
  171. #--------------------------------------------------------------------
  172. #    If a system doesn't have an opendir function (man, that's old!)
  173. #    then we have to supply a different version of dirent.h which
  174. #    is compatible with the substitute version of opendir that's
  175. #    provided.  This version only works with V7-style directories.
  176. #--------------------------------------------------------------------
  177.  
  178. AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))
  179.  
  180. #--------------------------------------------------------------------
  181. #    Check for the existence of sys_errlist (this is only needed if
  182. #    there's no strerror, but I don't know how to conditionalize the
  183. #    check).
  184. #--------------------------------------------------------------------
  185.  
  186. AC_MSG_CHECKING(sys_errlist)
  187. AC_TRY_LINK(, [
  188. extern char *sys_errlist[];
  189. extern int sys_nerr;
  190. sys_errlist[sys_nerr-1][0] = 0;
  191. ], tcl_ok=yes, tcl_ok=no)
  192. AC_MSG_RESULT($tcl_ok)
  193. if test $tcl_ok = no; then
  194.     AC_DEFINE(NO_SYS_ERRLIST)
  195. fi
  196.  
  197. #--------------------------------------------------------------------
  198. #    The check below checks whether <sys/wait.h> defines the type
  199. #    "union wait" correctly.  It's needed because of weirdness in
  200. #    HP-UX where "union wait" is defined in both the BSD and SYS-V
  201. #    environments.  Checking the usability of WIFEXITED seems to do
  202. #    the trick.
  203. #--------------------------------------------------------------------
  204.  
  205. AC_MSG_CHECKING([union wait])
  206. AC_TRY_LINK([#include <sys/types.h> 
  207. #include <sys/wait.h>], [
  208. union wait x;
  209. WIFEXITED(x);        /* Generates compiler error if WIFEXITED
  210.              * uses an int. */
  211. ], tcl_ok=yes, tcl_ok=no)
  212. AC_MSG_RESULT($tcl_ok)
  213. if test $tcl_ok = no; then
  214.     AC_DEFINE(NO_UNION_WAIT)
  215. fi
  216.  
  217. #--------------------------------------------------------------------
  218. #    Check to see whether the system supports the matherr function
  219. #    and its associated type "struct exception".
  220. #--------------------------------------------------------------------
  221.  
  222. AC_MSG_CHECKING([matherr support])
  223. AC_TRY_COMPILE([#include <math.h>], [
  224. struct exception x;
  225. x.type = DOMAIN;
  226. x.type = SING;
  227. ], tcl_ok=yes, tcl_ok=no)
  228. AC_MSG_RESULT($tcl_ok)
  229. if test $tcl_ok = yes; then
  230.     AC_DEFINE(NEED_MATHERR)
  231. fi
  232.  
  233. #--------------------------------------------------------------------
  234. #    Check to see whether the system provides a vfork kernel call.
  235. #    If not, then use fork instead.
  236. #--------------------------------------------------------------------
  237.  
  238. AC_FUNC_CHECK(vfork, , AC_DEFINE(vfork, fork))
  239.  
  240. AC_OUTPUT(Makefile)
  241.